using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Collections;

namespace MULENetworking
{
    public class Chat : MarshalByRefObject, IChat
    {
        private ArrayList arrClients = new ArrayList();
        private string strChatSession = "";

        #region IChat Members

        public void AddClient(string name)
        {
            if (name != null)
            {
                lock(arrClients)
                {
                    arrClients.Add(name);
                }
            }
        }

        public void RemoveClient(string name)
        {
            lock (arrClients)
            {
                arrClients.Remove(name);
            }
        }

        public void SendMessage(string newMessage)
        {
            if (newMessage != null)
            {
                lock (strChatSession)
                {
                    strChatSession += newMessage;
                }
            }
        }

        public ArrayList Clients
        {
            get { return arrClients; }
        }

        public string ChatSession
        {
            get { return strChatSession; }
        }

        #endregion

        public void CreatePlayer(string name, string avatar)
        {

        }

        public void CreateGame(string map, int level, string gameName)
        {

        }
    }
}
